﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using KPIS.GERP.GBMS.MODEL;
using Telerik.Web.UI;

namespace KPIS.GERP.GBMS.APP_UI.Controls
{
    public partial class YearCombo : System.Web.UI.UserControl
    {
        private bool postback = false;
        public event RadComboBoxSelectedIndexChangedEventHandler indexChange;

        public bool PostBack
        {
            set { postback = value; }
            get { return postback; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int CurrYear = SystemInfo._CurrentYear;
                year.Items.Clear();

                for (int i = CurrYear + 5; i >= CurrYear - 5; i--)
                {
                    year.Items.Add(new RadComboBoxItem(i.ToString(), i.ToString()));
                }
                year.SelectedValue = CurrYear.ToString();

                year.AutoPostBack = postback;
            }
        }

        internal void ClientID(string p)
        {
            throw new NotImplementedException();
        }

        internal RadComboBox Attributes(string p)
        {
            throw new NotImplementedException();
        }

        protected void year_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if (indexChange != null)
            {
                indexChange(this, e);
            }
        }
    }
}